<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>管理中心</title>
	<link href="../css/public.css" rel="stylesheet"/>
	<link href="../css/main.css?v=1" rel="stylesheet"/>
	<link href="../css/style.css" rel="stylesheet"/>
	<link href="../css/agent.css?v=21" rel="stylesheet"/>

	<script src="./js/jquery-1.9.1.js"></script>

	<script src="../js/swiper.min.js"></script>
	<script src="../js/mobile-util.js"></script>
	<script src="../js/public.js"></script>
	<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	<script src="../js/jquery.cookie.js"></script>
    <script src="../../mifiadmin/js/common.js"></script>

	<script>
		/*获取url参数*/
		function getUrlParam(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
			var r = window.location.search.substr(1).match(reg);  //匹配目标参数
			if (r != null) return unescape(r[2]); return null; //返回参数值
		}

		/*获取url参数end*/
	</script>

	<style>
		.levellistright span{
			font-weight: 600;
			color: #333;
		}
	</style>

</head>
<body >

<div class="markbox">
	<img src="../img/loading1.gif" />
</div>

<header class="mui-bar mui-bar-nav indexheader bluebg flex">
	<div class="headerlogo" onclick="back()">
		<i class="iconfont backbtn">&#xe602;</i>
	</div>

	<div class="headertitle">
		<p>管理中心</p>
	</div>

	<div class="headerright timeright hide">
		<p class="timepbox iconfont">&#xe6d9;</p>
	</div>

</header>

<main class="agentbox">

	<div class="headerbox" id="levelagent">
		<div class="headportrait">
			<img src="../img/center.png">
		</div>

		<div class="headerinfo">
			<p class="headtitle"></p>
			<p class="headgrade">
				<span id="agentgrade">管理员</span>
			</p>
		</div>

		<div class="iconfont headright">
			&#xe601;
		</div>

	</div>

	<div class="div-5rem"></div>


	<div class="levelmeun">

		<div class="levellist" id="addagent">
			<div class="levellisticon bg-blue">
				<i class="iconfont">&#xe651;</i>
			</div>
			
			<div class="levellistname">
				添加设备
			</div>

			<div class="levellistright">

				<i class="iconfont">&#xe601;</i>
			</div>

		</div>

		<!-- <div class="levellist" id="levelmanagement">
			<div class="levellisticon bg-pig">
				<i class="iconfont">&#xe61d;</i>
			</div>

			<div class="levellistname">
				二级代理管理
			</div>

			<div class="levellistright">
				<span id="levelagentnum"></span>
				<i class="iconfont">&#xe601;</i>
			</div>

		</div> -->

		<!-- <div class="levellist" id="recordincome">
			<div class="levellisticon bg-yellow">
				<i class="iconfont">&#xe62d;</i>
			</div>

			<div class="levellistname" style="width: 7rem">
				收入记录
			</div>

			<div class="levellistright" style="width: 4.5rem">
				<span id="levelrechge" style="display: block;float: left;width: 3.7rem;overflow: hidden"></span>
				<i class="iconfont">&#xe601;</i>
			</div>

		</div> -->

		<div class="levellist" id="devicemanagement">
			<div class="levellisticon bg-blue">
				<i class="iconfont">&#xe6ec;</i>
			</div>

			<div class="levellistname">
				设备管理
			</div>

			<div class="levellistright">
				<span id="leveldevicema"></span>
				<i class="iconfont">&#xe601;</i>
			</div>

		</div>


		<div class="levellist" id="orderrecord">
			<div class="levellisticon bg-red">
				<i class="iconfont">&#xe640;</i>
			</div>

			<div class="levellistname">
				订单记录
			</div>

			<div class="levellistright">
				<span id="levelorder"></span>
				<i class="iconfont">&#xe601;</i>
			</div>

		</div>


		<!--<div class="levellist" id="settlement">-->
			<!--<div class="levellisticon bg-pig">-->
				<!--<i class="iconfont">&#xe6c0;</i>-->
			<!--</div>-->

			<!--<div class="levellistname">-->
				<!--结算记录-->
			<!--</div>-->

			<!--<div class="levellistright">-->
				<!--<span id="settlementorder"></span>-->
				<!--<i class="iconfont">&#xe601;</i>-->
			<!--</div>-->

		<!--</div>-->



		<div class="levellist" id="company">
			<div class="levellisticon bg-green">
				<i class="iconfont">&#xe64c;</i>
			</div>

			<div class="levellistname">
				公司介绍
			</div>

			<div class="levellistright">

				<i class="iconfont">&#xe601;</i>
			</div>

		</div>


	</div>


</main>


<script>

	var tooken=$.cookie("tooken");


	//alert(tooken);

	if(tooken==null||tooken==undefined||tooken==""){

		window.location.href="../agent/login.html";

	}else {

		var name=$.cookie("tooken");

		// var url="http://qt.hiberbest.com";
		//var url="http://192.168.0.132:69";

		var geturl=url+ "/Admin/agentapi/agentinfo?tooken="+name;

		var cce;
		cee = setTimeout(function(){
			$('.markbox').hide();
			clearTimeout(cce);

		}, 1000);





		$.ajax({
			type: 'get',
			dataType: "json",
			url: geturl,
			success: function (data) {
				//console.log(data);
				var suc=data.success;
				if(suc.code == 4007){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4011){
					alert(suc.message);
					window.location.href="login.html";
				}else if(suc.code == 4000){
					var agent=data.agent;
					var agent_level=agent.agent_level;

					if(agent_level==1){
						$('#agentgrade').html("管理员");
					}

					if(agent.agent_name==null||agent.agent_name==undefined||agent.agent_name==""){
						$('.headtitle').html("千里狐wifi");
					}else{
						$('.headtitle').html(agent.agent_name);
					}
					var device=data.device;

					$('#levelagentnum').html(data.agent2count);
					$('#levelrechge').html(data.money);
					$('#leveldevicema').html(device.count);
					$('#levelorder').html(data.order);
				}

			},error:function(data){
				console.log("请检查您的网络");
			}
		});
	}


	$('#addagent').click(function(){
		window.location.href="addagent.html";
	});

	$('#levelmanagement').click(function(){
		window.location.href="levelagent.html";
	});

	$('#recordincome').click(function(){
		window.location.href="levelmyincome.html";
	});

	$('#devicemanagement').click(function(){
		window.location.href="levelmydevice.html";
	});

	$('#orderrecord').click(function(){
		window.location.href="levelrechargerecord.html";
	});

	$('#company').click(function(){
		window.location.href="../agent/company.html";
	});

	// $('#levelagent').click(function () {
	// 	window.location.href="levelagentinfo.html";
	// })

</script>


</body>
</html>
